package arsmodeller.part;

import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPartFactory;

import arsmodeller.model.BusinessProcess;
import arsmodeller.model.Employee;
import arsmodeller.model.MainModel;
import arsmodeller.model.Service;
import arsmodeller.part.tree.BusinessProcessTreeEditPart;
import arsmodeller.part.tree.EmployeeTreeEditPart;
import arsmodeller.part.tree.EnterpriseTreeEditPart;
import arsmodeller.part.tree.ServiceTreeEditPart;

public class AppTreeEditPartFactory implements EditPartFactory {
	@Override
	public EditPart createEditPart(EditPart context, Object model) {
		EditPart part = null;
		if (model instanceof MainModel)
			part = new EnterpriseTreeEditPart();
		else if (model instanceof Service)
			part = new ServiceTreeEditPart();
		else if (model instanceof Employee)
			part = new EmployeeTreeEditPart();
		else if (model instanceof BusinessProcess) {
			part = new BusinessProcessTreeEditPart();
		}
		if (part != null)
			part.setModel(model);
		return part;
	}
}